﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WellQuery1.aspx.cs" Inherits="GroundWater.Basedata.WellQuery1" %>
<%@ Register src="WellEditView.ascx" tagname="WellEditView" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <script language="javascript" src="../js/jquery.js" type="text/javascript"></script>
    <script language="javascript" src="../js/common.js" type="text/javascript"></script>
    <link media="all" href="../js/resources/_Common/Common.css" type=text/css rel=stylesheet />
<link media="all" href="../js/resources/_Loadding/Loadding.css" type=text/css rel=stylesheet />
<link media="all" href="../js/resources/_Panel/Panel.css" type=text/css rel=stylesheet />
<link media="all" href="../js/resources/_Button/Button.css" type=text/css rel=stylesheet />
<link media="all" href="../js/resources/_TextBox/TextBox.css" type=text/css rel=stylesheet />
</head>
<body>
    <form id="form1" runat="server"><ajaxToolkit:ToolkitScriptManager runat="server" ID="sm"  />
    <asp:ObjectDataSource ID="odsWells" runat="server" SelectMethod="GetAll" 
        TypeName="GroundWater.BusinessActions.Well" DeleteMethod="DeleteById" 
        ondeleting="odsWells_Deleting" >
    <SelectParameters>
        <asp:Parameter Name="isStoredProc" Type="Boolean" DefaultValue="False" />
        <asp:Parameter Name="enableCache" Type="Boolean" DefaultValue="True" />
    </SelectParameters>
    <DeleteParameters>
        <asp:Parameter Name="id" Type="String" />
        <asp:Parameter Name="isStoredProc" Type="Boolean" DefaultValue="False" />
        <asp:Parameter Name="removeCache" Type="Boolean" DefaultValue="True" />
        <asp:Parameter Name="logical" Type="Boolean" DefaultValue="False" />
    </DeleteParameters>
    </asp:ObjectDataSource>
    <div style="width:100%;">
        <p style="font-weight:bold; font-family:Tahoma; margin-bottom:10px; "></p>
        <div class="grid">
            <div class="rounded">
                <div class="top-outer"><div class="top-inner"><div class="top">
                    <h2>水井信息 </h2>
                </div></div></div>
                <div class="mid-outer"><div class="mid-inner"><div class="mid">     
                
                    <!-- Content Goes Here! -->
                    <asp:UpdatePanel ID="updPanel" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:GridView  ID="gvWells" runat="server" DataSourceID="odsWells" OnRowDataBound="RowDataBound" SkinID="PagingGridView" DataKeyNames="Code" EnableViewState="false">
                                <Columns>
                                    <asp:BoundField  HeaderText="水源井代码" DataField="Code" SortExpression="Code" HeaderStyle-CssClass="first" ItemStyle-CssClass="first" />
                                    <asp:BoundField  HeaderText="水源井名称" DataField="Name"   SortExpression="Name" />
                                    <asp:BoundField  HeaderText="经度" DataField="Longitude"   SortExpression="Longitude" />
                                    <asp:BoundField  HeaderText="纬度" DataField="Latitude"   SortExpression="Latitude" />
                                    <asp:BoundField  HeaderText="探头高程" DataField="Depth"   SortExpression="Depth" />
                                    <asp:BoundField  HeaderText="凿井日期" DataField="ShaftSinkingDate" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="false"  SortExpression="ShaftSinkingDate" />
                                    <asp:BoundField  HeaderText="设备卡号" DataField="SIMCard"   SortExpression="SIMCard" />
                                    <asp:BoundField  HeaderText="设备地址" DataField="BTUAddress"   SortExpression="BTUAddress" />
                                    <asp:BoundField  HeaderText="剖面" DataField="SectionPlane"   SortExpression="SectionPlane" />
                                    <asp:TemplateField><ItemTemplate><asp:LinkButton id="btnEdit" runat="server" CommandName="Select" OnClick="btnEdit_Click">编辑</asp:LinkButton></ItemTemplate></asp:TemplateField>
                                    <asp:CommandField ShowDeleteButton="true" DeleteText="删除" />
                                </Columns>
                            </asp:GridView>
                        </ContentTemplate>
                    </asp:UpdatePanel>                     
    
                </div></div></div>
            <div class="bottom-outer"><div class="bottom-inner">
            <div class="bottom"></div></div></div>                   
        </div>      
        </div>
    </div>
    
<!-- 面板内容 -->                
<div id="bodyPanel">

<asp:Panel ID="PopupPanel" runat="server" CssClass="x-pne" style="display:none; z-index:9999;  width:710px;">

<asp:UpdatePanel ID="updPnl" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:HiddenField ID="hidWellCode" runat="server" />
<asp:Button id="btnShowPopupHelper" runat="server" style="display:none" />
    <ajaxToolKit:ModalPopupExtender ID="mdlPopup" runat="server" 
    BehaviorID="editWell" 
    TargetControlID="btnShowPopupHelper" 
    PopupControlID="PopupPanel" 
    DropShadow="false"
    PopupDragHandleControlID="DragPanel"
    BackgroundCssClass="modalBackground"
    CancelControlID="btnClose"
    /><%--Y="2"--%>

    <asp:Panel ID="DragPanel" runat="server" CssClass="corner-bg x-pne-lt x-pne-left">
    <div class="corner-bg x-pne-rt x-pne-right">
    <div class="corner-bg x-pne-t drag">
    <div class=x-pne-btn style="background-position: 0px 0px" onclick="$find('editWell').hide();" ></div>
    <div class="x-pne-caption font drag" >编辑水井信息</div>
    </div>
    </div>
    </asp:Panel>
    
    <div>
    <div class="side-bg x-pne-l">
    <div class="side-bg x-pne-r">
    <div class="x-pne-c" style="WIDTH: 698px; HEIGHT: 358px">
    <div id="contentPanel"><!-- 控件实例 -->

    <div class=gbPanel>
        <%--<uc1:WellEditView ID="wellEditView" runat="server" />--%>
<table id="tblWell" class="font" style="width: 100%;">
    <tr>
        <td>水井编号</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtWellCode"  maxlength="16" /><span class="warning">*</span></td>
        <td>水井名称</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtWellName"  maxlength="16" /><span class="warning">*</span></td>
        <td>水源地代码</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtWaterSource"  maxlength="16" /><span class="warning">*</span></td>
    </tr>
    <tr>
        <td>经度</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtLongitude"  maxlength="16" /><span class="warning">*</span></td>
        <td>纬度</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtLatitude"  maxlength="16" /><span class="warning">*</span></td>
        <td>地形</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtLandform"  maxlength="16" /></td>
    </tr>
    <tr>
        <td>水资源分区代码</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtResourceRegionCode"  maxlength="16" /><span class="warning">*</span></td>
        <td>行政区划代码</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtAdministrativeDivisionsCode"  maxlength="16" /><span class="warning">*</span></td>
        <td>水功能区代码</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtFunctionRegionCode"  maxlength="16" /><span class="warning">*</span></td>
    </tr>
    <tr>
        <td>探头高程</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtDepth"  maxlength="16" /></td>
        <td>地面高程</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtAltitude"  maxlength="16" /></td>
        <td>凿井日期</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtShaftSinkingDate"  maxlength="16" />&nbsp;<img onclick="WdatePicker({el:$dp.$('txtShaftSinkingDate')})" src="../js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle" /></td>
    </tr>
    <tr>
        <td>孔径</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtDiameter"  maxlength="16" /></td>
        <td>运行状况</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtProjectRuningState"  maxlength="16" /></td>
        <td>水泵型号</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtPumpType"  maxlength="16" /></td>
    </tr>
    <tr>
        <td>设计年取水量</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtDesignYearlyWaterQuantity"  maxlength="16" /><span class="warning">*</span></td>
        <td>设计流量</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtDesignFlowRate"  maxlength="16" /></td>
        <td>剖面</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtSectionPlane"  maxlength="16" /></td>
    </tr>
    <tr>
        <td>静水位</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtStaticLevel"  maxlength="16" /></td>
        <td>动水位</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtDynamicLevel"  maxlength="16" /></td>
        <td>剖面序号</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtSequenceNumber"  maxlength="16" /></td>
    </tr>
    <tr>
        <td>设备卡号</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtSIMCard"  maxlength="16" /><span class="warning">*</span></td>
        <td>设备地址</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtBTUAddress"  maxlength="16" /><span class="warning">*</span></td>
        <td>除铁除锰装置</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtRemoveEquipment"  maxlength="16" /></td>
    </tr>
    <tr>
        <td>管理单位</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtAdministration"  maxlength="16" /></td>
        <td>水质情况</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtWaterQuality"  maxlength="16" /></td>
        <td>最低警戒水位</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtMinimumWaterlevel"  maxlength="16" /></td>
    </tr>
    <tr>
        <td>最高警戒水位</td><td><asp:TextBox runat="server" CssClass="textField text-bg border-blur" id="txtMaximumWaterlevel"  maxlength="16" /></td>
        <td></td><td></td>
        <td></td><td></td>
    </tr>
</table>
    </div>

    <div class="gbPanel" style="margin-top:20px; text-align:center;">
    <table class="method-area1" style="margin:0 auto; text-align:left;">
    <tbody>
    <tr>
    <td style="padding-left:30px;">
        <div>
            <div class="btn-side btn-bg" style="background-position: 0% 0%"></div>
            <div class="btn-body btn-bg" style="background-position: 0px 168px; WIDTH: 60px"><asp:Button ID="btnOK" runat="server" Text="保  存" CssClass="font" OnClick="btnOK_Click" OnClientClick="return validateWell();" /></div><%----%>
            <div class="btn-side btn-bg" style="background-position: 0px 189px"></div>
        </div>
    </td>
    <td style="padding-left:30px;">
        <div>
            <div class="btn-side btn-bg" style="background-position: 0% 0%"></div>
            <div class="btn-body btn-bg" style="background-position: 0px 168px; WIDTH: 60px"><asp:Button ID="btnClose" runat="server" Text="取  消" CssClass="font" /></div>
            <div class="btn-side btn-bg" style="background-position: 0px 189px"></div>
        </div>
    </td>
    </tr>

    </tbody>
    </table>
    </div>


    </div>
    </div>
    </div>
    </div>
    
    <div class="corner-bg x-pne-lb x-pne-left">
        <div class="corner-bg x-pne-rb x-pne-right">
            <div class="corner-bg x-pne-b"></div>
        </div>
    </div>
    </div>
    
     </ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAdd" />
</Triggers>
 </asp:UpdatePanel>
</asp:Panel>

</div>
<!-- 面板内容结束 -->

    
    
    <div style="margin-left:36px; margin-top:10px;"><asp:Button ID="btnAdd" runat="server" Text="添加水井" CssClass="BigButton" OnClick="btnAdd_Click" /></div>
    
<asp:updateprogress id="updateProgress" runat="server" DynamicLayout="true" DisplayAfter="200">
    <progresstemplate>
        <div id="progressBackgroundFilter"></div>
        <div id="processMessage">正在处理数据，请稍等...<br /><br /><img alt="Loading" src="../images/loading_16.gif" /></div>
    </progresstemplate>
</asp:updateprogress>

<script type="text/javascript">
//<![CDATA[
    function validateWell() {
        var message = "";
        if (!notEmpty($get("txtWellCode"))) {
            message += "水井代号不能为空。\n";
        }
        if (!notEmpty($get("txtWellName"))) {
            message += "水井名称不能为空。\n";
        }
        if (!notEmpty($get("txtWaterSource"))) {
            message += "水源地代码。\n";
        }
        if (!notEmpty($get("txtResourceRegionCode"))) {
            message += "水资源分区代码。\n";
        }
        if (!notEmpty($get("txtAdministrativeDivisionsCode"))) {
            message += "行政区划代码。\n";
        }
        if (!notEmpty($get("txtFunctionRegionCode"))) {
            message += "水功能区代码。\n";
        }
        if (!notEmpty($get("txtDesignYearlyWaterQuantity"))) {
            message += "设计年取水量。\n";
        }
        if (!notEmpty($get("txtSIMCard"))) {
            message += "设备卡号。\n";
        }
        if (!notEmpty($get("txtBTUAddress"))) {
            message += "设备地址。\n";
        }
        if (!notEmpty($get("txtLongitude"))) {
            message += "水井的经度不能为空。\n";
        }
        if (!notEmpty($get("txtLatitude"))) {
            message += "水井的纬度不能为空。\n";
        }
        if (!notEmpty($get("txtDepth"))) {
            message += "水井的深度不能为空。\n";
        }
        if (!notEmpty($get("txtShaftSinkingDate"))) {
            message += "井的开凿日期不能为空。\n";
        }


        if (!isInteger($get("txtAdministrativeDivisionsCode").value)) {
            message += "行政区划代码为正整数。\n";
        }
        if (!isNum($get("txtLongitude").value)) {
            message += "井的经度为数值。\n";
        }
        if (!isNum($get("txtLatitude").value)) {
            message += "井的纬度为数值。\n";
        }
        if (!isNum($get("txtDepth").value)) {
            message += "探头高程为数值。\n";
        }
        if (!isNum($get("txtAltitude").value)) {
            message += "地面高程为数值。\n";
        }
        
        if (!isInteger($get("txtSequenceNumber").value)) {
            message += "剖面序号为正整数。\n";
        }
        

        if (!isNum($get("txtDesignYearlyWaterQuantity").value)) {
            message += "设计年取水量为数值。\n";
        }
        if (!isNum($get("txtDesignFlowRate").value)) {
            message += "设计流量为数值。\n";
        }
        if (!isNum($get("txtDiameter").value)) {
            message += "孔径为数值。\n";
        }
        if (!isNum($get("txtStaticLevel").value)) {
            message += "静水位为数值。\n";
        }
        if (!isNum($get("txtDynamicLevel").value)) {
            message += "动水位为数值。\n";
        }

        if (!isNum($get("txtMinimumWaterlevel").value)) {
            message += "最低警戒水位为数值。\n";
        }
        if (!isNum($get("txtMaximumWaterlevel").value)) {
            message += "最高警戒水位为数值。\n";
        }
        
        if (!validateCNDate($get("txtShaftSinkingDate").value)) {

            message += "开凿日期格式不正确。\n";
        }

        if (notEmpty($get("txtLatitude")) && isNum($get("txtLatitude").value)) {
            if (parseFloat($get("txtLatitude").value) > 99) {
                message += "井的纬度不能大于100。\n";
            }
        }
        
        if (message.length > 0) {
            alert(message);
            return false;
        }
        return true;
    }

    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_pageLoading(pageLoadingHandler);
    function pageLoadingHandler(sender, args) {
        // sender:Sys.WebForms.PageRequestManager
        // args : Sys.WebForms.PageLoadingEventArgs
        var dataItems = args.get_dataItems();
//        var panelsDeleting = args.get_panelsDeleting();
//        var panelsUpdating = args.get_panelsUpdating();
        if (dataItems['updPanel'] && dataItems['updPanel'] == "1") {
            alert("该水井已有监测数据了，不能删除。");
        }
    }


    function pageLoad() {
        var mpe = $find("editWell");
        mpe.add_hidden(onHidden);
    }
    function onHidden() {
        document.getElementById("hidWellCode").value = "";
        //document.getElementById("hidMonitorTime").value = "";
        //document.getElementById("hidAltitude").value = "";
    }
    
    
//]]>
</script>
<asp:Literal ID="lblJavaScript" EnableViewState="false" runat="server"></asp:Literal>
    </form>
    
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
</body>
</html>
